 const mine = {
  state: {
    userInfo: {},
    userData: {}
  },
  mutations: {
    // 同步修改state数据
    setUserInfo(state, data) {
      state.userData = data
    },
  },
  actions: {
    // 处理异步
    async getInfo({ commit }, userInfo) {
      let params  = {
        ...userInfo
      }
      const { data, code } = await this.getInfo(params)
      if (code === this.$codeConfig.HTTP_SUCCESS) {
        commit('setUserInfo', data)
      }
    },
  },
  getters: {
    userName: state => state.userInfo.name
  }
}
export default mine